#include <dbg.h>
#include <gtest/gtest.h>

using namespace std;

class Solution {
public:
    int maxPower(string s) {
        int res = 1;

        int n = s.size();
        if (n == 1) {
            return res;
        }

        int cnt = 1;
        for (int i = 1; i < n; ++i) {
            if (s[i] == s[i - 1]) {
                ++cnt;
                res = max(res, cnt);
            } else {
                cnt = 1;
            }
        }

        return res;
    }
};

TEST(TEST1, maxPower) {
    Solution solution;

    string s = "leetcode";
    EXPECT_EQ(solution.maxPower(s), 2);
}

TEST(TEST2, maxPower) {
    Solution solution;

    string s = "abbcccddddeeeeedcba";
    EXPECT_EQ(solution.maxPower(s), 5);
}

int main(int argc, char** argv) {
    ::testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}